using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class Btn_popup : MonoBehaviour
{
    public Ui_popup target;
    public bool isPopUp = false;

    void Start()
    {
        transform.GetComponent<Button>().onClick.AddListener(OnBtnClick);
        if (isPopUp)
        {
            target.Init();
            target.PopUp();
        }
    }

    private void OnBtnClick()
    {
        isPopUp = !isPopUp;
        if (isPopUp)
            target.PopUp();
        else
            target.Hide();
    }
}